const p = new Promise((resolve, reject) => {
  setTimeout(() => {
    console.log('p1 执行了');
    resolve(123)
  }, 3000);
});

function wrap(promise){
  let abort;
  let newPromise = new Promise((resolve, reject) => {
    abort = reject
  });
  let p = Promise.race([newPromise, promise]);
  p.abort = abort
  return p;
}

const p1 = wrap(p);
setTimeout(() => {
  p1.abort('传点什么');
}, 2000);

p1.then(data => {
  console.log(data);
}).catch(err => {
  console.log('已取消');
  console.log('err:',err);
});
